{% extends "base.html" %}

{% block title %}编辑个人主页 - {{ config.SITE_NAME }}{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0">编辑个人主页</h4>
            </div>
            <div class="card-body">
                <form method="POST" enctype="multipart/form-data">
                    {{ form.hidden_tag() }}
                    <div class="mb-3">
                        <label class="form-label">选择板块</label>
                        <select name="section_type" class="form-select">
                            <option value="about_me">关于我</option>
                            <option value="study">学习与探索</option>
                            <option value="interest">兴趣与爱好</option>
                            <option value="project">校园实践项目</option>
                        </select>
                    </div>
                    <div class="mb-3">
                        {{ form.title.label(class="form-label") }}
                        {{ form.title(class="form-control") }}
                        {% if form.title.errors %}
                            {% for error in form.title.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        {{ form.content.label(class="form-label") }}
                        {{ form.content(class="form-control", rows=10) }}
                        {% if form.content.errors %}
                            {% for error in form.content.errors %}
                                <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        <label class="form-label">上传图片</label>
                        <input type="file" name="image" class="form-control" accept="image/*">
                        <div class="form-text">支持 jpg、png、gif 格式，最大 16MB</div>
                    </div>
                    <div class="d-grid gap-2">
                        {{ form.submit(class="btn btn-primary") }}
                        <a href="{{ url_for('main_zyy.profile_zyy', username=current_user.username) }}" class="btn btn-outline-secondary">返回主页</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %} 